package com.joven.shelltest.utils.paramlogregex;

import com.joven.shelltest.annotation.ParamLog;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author wzj
 * @Date 2023-07-26 10:18
 **/
@Aspect
@Component
public class ParamLogAspect {

    @Autowired
    ResolverKit resolverKit;

    @Around("@annotation(paramLog)")
    public Object around(ProceedingJoinPoint joinPoint, ParamLog paramLog) throws Throwable {
        String contextEL = paramLog.regex();
        String content = String.valueOf(resolverKit.resolverContent(contextEL, joinPoint));
        System.out.println(content);
        return joinPoint.proceed();
    }
}
